import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import 'amfe-flexible'

// 按需导入Vant组件
import {
  Field,
  Button,
  Icon,
  Cell,
  Popup,
  Picker,
  DatetimePicker,
  Dialog,
  Uploader,
  Toast,
  Tag,
  Rate,
  Empty,
  ImagePreview,
  List,
  PullRefresh,
  Loading,
  Form,
  RadioGroup,
  Radio,
  Overlay,
  NavBar,
  Tab,
  Tabs,
  Image as VanImage,
  DropdownMenu,
  DropdownItem,
} from "vant";

// 注册需要的Vant组件
Vue.use(Field)
Vue.use(Button)
Vue.use(Icon)
Vue.use(Cell)
Vue.use(Popup)
Vue.use(Picker)
Vue.use(DatetimePicker)
Vue.use(Dialog)
Vue.use(Uploader)
Vue.use(Toast)
Vue.use(Tag);
Vue.use(Rate);
Vue.use(Empty);
Vue.use(ImagePreview);
Vue.use(List);
Vue.use(PullRefresh);
Vue.use(Loading);
Vue.use(Form);
Vue.use(RadioGroup);
Vue.use(Radio);
Vue.use(Overlay);
Vue.use(NavBar);
Vue.use(Tab);
Vue.use(Tabs);
Vue.use(VanImage);
Vue.use(DropdownMenu);
Vue.use(DropdownItem);

// 注册无限滚动指令
Vue.directive('infinite-scroll', List.infiniteScroll);

// 全局样式
import "@/assets/css/reset.css";
import "@/assets/css/common.css";

// 导入网络请求配置
import request from '@/utils/request'
import api from '@/api'

// 将网络请求方法挂载到Vue原型上，方便在组件中使用
Vue.prototype.$http = request
Vue.prototype.$api = api

// 移动端调试工具（仅开发环境）
// if (process.env.NODE_ENV === 'development') {
//   require('@/utils/mobile-debug.js')
// }

Vue.config.productionTip = false

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')

